//---------------------------------------------------------------------------------------------------
template <class T>
TSharedArray<T>::TSharedArray(int iQuantity, T* atArray)
{
	m_iQuantity = iQuantity;
	m_atArray = atArray;
}
//---------------------------------------------------------------------------------------------------
template <class T>
TSharedArray<T>::TSharedArray(const TSharedArray& rkShared)
{
	m_atArray = 0;
	*this = rkShared;
}
//---------------------------------------------------------------------------------------------------
template <class T>
TSharedArray<T>::~TSharedArray()
{
	delete[] m_atArray;
}
//---------------------------------------------------------------------------------------------------
template <class T>
TSharedArray<T>& TSharedArray<T>::operator= (const TSharedArray& rkShared)
{
	delete[] m_atArray;
	m_iQuantity = rkShared.m_iQuantity;
	if (rkShared.m_atArray)
	{
		m_atArray = new T[m_iQuantity];
		for (int i = 0; i < m_iQuantity; i++)
		{
			m_atArray[i] = rkShared.m_atArray[i];
		}
	}
	else
	{
		m_atArray = 0;
	}
	return *this;
}
//---------------------------------------------------------------------------------------------------
template <class T>
int TSharedArray<T>::GetQuantity() const
{
	return m_iQuantity;
}
//---------------------------------------------------------------------------------------------------
template <class T>
T* TSharedArray<T>::GetData() const
{
	return m_atArray;
}
//---------------------------------------------------------------------------------------------------
template <class T>
TSharedArray<T>::operator const T* () const
{
	return m_atArray;
}
//---------------------------------------------------------------------------------------------------
template <class T>
TSharedArray<T>::operator T* ()
{
	return m_atArray;
}
//---------------------------------------------------------------------------------------------------
template <class T>
const T& TSharedArray<T>::operator[] (int i) const
{
	assert(0 <= i && i < m_iQuantity);
	return m_atArray[i];
}
//---------------------------------------------------------------------------------------------------
template <class T>
T& TSharedArray<T>::operator[] (int i)
{
	assert(0 <= i && i < m_iQuantity);
	return m_atArray[i];	
}
//---------------------------------------------------------------------------------------------------
template <class T>
void TSharedArray<T>::SetActiveQuantity(int iActiveQuantity)
{
	assert(iActiveQuantity >= 0);
	m_iQuantity = iActiveQuantity;
}
//---------------------------------------------------------------------------------------------------